package com.shangcheng.controller;

import com.shangcheng.common.Result;
import com.shangcheng.entity.TCategory;
import com.shangcheng.service.CategoryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author leng
 * @since 2025-06-21
 */
@RestController
@RequestMapping("/tCategory")
public class TCategoryController {
    @Autowired
    private CategoryServiceImpl categoryService;
    @PostMapping
    public Result<TCategory> addCategory(@RequestBody TCategory category) {
        TCategory newCategory = categoryService.addCategory(category);
        return Result.ok(newCategory);
    }
}
